package com.lujianfei.productprice.ui.cart;

import android.os.Parcel;
import android.os.Parcelable;

import com.orm.SugarRecord;
import com.orm.dsl.Column;
import com.orm.dsl.Ignore;
import com.orm.dsl.Table;

@Table(name = "CartEntity")
public class CartEntity extends SugarRecord implements Parcelable {

    @Column(name = "shopId")
    private long shopId;

    @Column(name = "productId")
    private long productId;

    @Column(name = "quantity")
    private int quantity;

    @Ignore
    private String shopName;

    @Ignore
    private String productName;

    @Ignore
    private double productPrice;

    public CartEntity() {
    }

    protected CartEntity(Parcel in) {
        shopId = in.readLong();
        productId = in.readLong();
        quantity = in.readInt();
        shopName = in.readString();
        productName = in.readString();
        productPrice = in.readDouble();
    }

    public static final Creator<CartEntity> CREATOR = new Creator<CartEntity>() {
        @Override
        public CartEntity createFromParcel(Parcel in) {
            return new CartEntity(in);
        }

        @Override
        public CartEntity[] newArray(int size) {
            return new CartEntity[size];
        }
    };

    public long getShopId() {
        return shopId;
    }

    public void setShopId(long shopId) {
        this.shopId = shopId;
    }

    public long getProductId() {
        return productId;
    }

    public void setProductId(long productId) {
        this.productId = productId;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public double getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(double productPrice) {
        this.productPrice = productPrice;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(shopId);
        dest.writeLong(productId);
        dest.writeInt(quantity);
        dest.writeString(shopName);
        dest.writeString(productName);
        dest.writeDouble(productPrice);
    }
}
